3.9.8 \(\int (f+g x)^n (a+2 c d x+c e x^2) \, dx\) [808]

Optimal. Leaf size=84 \[ \frac {\left (a g^2+c f (e f-2 d g)\right ) (f+g x)^{1+n}}{g^3 (1+n)}-\frac {2 c (e f-d g) (f+g x)^{2+n}}{g^3 (2+n)}+\frac {c e (f+g x)^{3+n}}{g^3 (3+n)} \]

[Out]

(a*g^2+c*f*(-2*d*g+e*f))*(g*x+f)^(1+n)/g^3/(1+n)-2*c*(-d*g+e*f)*(g*x+f)^(2+n)/g^3/(2+n)+c*e*(g*x+f)^(3+n)/g^3/
(3+n)

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 84, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.048, Rules used = {712} \begin {gather*} \frac {(f+g x)^{n+1} \left (a g^2+c f (e f-2 d g)\right )}{g^3 (n+1)}-\frac {2 c (e f-d g) (f+g x)^{n+2}}{g^3 (n+2)}+\frac {c e (f+g x)^{n+3}}{g^3 (n+3)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(f + g*x)^n*(a + 2*c*d*x + c*e*x^2),x]

[Out]

((a*g^2 + c*f*(e*f - 2*d*g))*(f + g*x)^(1 + n))/(g^3*(1 + n)) - (2*c*(e*f - d*g)*(f + g*x)^(2 + n))/(g^3*(2 +
n)) + (c*e*(f + g*x)^(3 + n))/(g^3*(3 + n))

Rule 712

Int[((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d +
 e*x)^m*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*
e + a*e^2, 0] && NeQ[2*c*d - b*e, 0] && IntegerQ[p] && (GtQ[p, 0] || (EqQ[a, 0] && IntegerQ[m]))

Rubi steps

\begin {align*} \int (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx &=\int \left (\frac {\left (a g^2+c f (e f-2 d g)\right ) (f+g x)^n}{g^2}+\frac {2 c (-e f+d g) (f+g x)^{1+n}}{g^2}+\frac {c e (f+g x)^{2+n}}{g^2}\right ) \, dx\\ &=\frac {\left (a g^2+c f (e f-2 d g)\right ) (f+g x)^{1+n}}{g^3 (1+n)}-\frac {2 c (e f-d g) (f+g x)^{2+n}}{g^3 (2+n)}+\frac {c e (f+g x)^{3+n}}{g^3 (3+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.10, size = 92, normalized size = 1.10 \begin {gather*} \frac {(f+g x)^{1+n} \left (a g^2 \left (6+5 n+n^2\right )+2 c d g (3+n) (-f+g (1+n) x)+c e \left (2 f^2-2 f g (1+n) x+g^2 \left (2+3 n+n^2\right ) x^2\right )\right )}{g^3 (1+n) (2+n) (3+n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(f + g*x)^n*(a + 2*c*d*x + c*e*x^2),x]

[Out]

((f + g*x)^(1 + n)*(a*g^2*(6 + 5*n + n^2) + 2*c*d*g*(3 + n)*(-f + g*(1 + n)*x) + c*e*(2*f^2 - 2*f*g*(1 + n)*x
+ g^2*(2 + 3*n + n^2)*x^2)))/(g^3*(1 + n)*(2 + n)*(3 + n))

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 147, normalized size = 1.75

method result size
gosper \(\frac {\left (g x +f \right )^{1+n} \left (c e \,g^{2} n^{2} x^{2}+2 c d \,g^{2} n^{2} x +3 c e \,g^{2} n \,x^{2}+8 c d \,g^{2} n x -2 c e f g n x +2 c e \,x^{2} g^{2}+a \,g^{2} n^{2}-2 c d f g n +6 c d \,g^{2} x -2 c e f g x +5 a \,g^{2} n -6 c d f g +2 c e \,f^{2}+6 a \,g^{2}\right )}{g^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}\) \(147\)
norman \(\frac {c e \,x^{3} {\mathrm e}^{n \ln \left (g x +f \right )}}{3+n}+\frac {f \left (a \,g^{2} n^{2}-2 c d f g n +5 a \,g^{2} n -6 c d f g +2 c e \,f^{2}+6 a \,g^{2}\right ) {\mathrm e}^{n \ln \left (g x +f \right )}}{g^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}+\frac {\left (2 c d f g \,n^{2}+a \,g^{2} n^{2}+6 c d f g n -2 c e \,f^{2} n +5 a \,g^{2} n +6 a \,g^{2}\right ) x \,{\mathrm e}^{n \ln \left (g x +f \right )}}{g^{2} \left (n^{3}+6 n^{2}+11 n +6\right )}+\frac {\left (2 d g n +e f n +6 d g \right ) c \,x^{2} {\mathrm e}^{n \ln \left (g x +f \right )}}{g \left (n^{2}+5 n +6\right )}\) \(209\)
risch \(\frac {\left (c e \,g^{3} n^{2} x^{3}+2 c d \,g^{3} n^{2} x^{2}+c e f \,g^{2} n^{2} x^{2}+3 c e \,g^{3} n \,x^{3}+2 c d f \,g^{2} n^{2} x +8 c d \,g^{3} n \,x^{2}+c e f \,g^{2} n \,x^{2}+2 c e \,x^{3} g^{3}+a \,g^{3} n^{2} x +6 c d f \,g^{2} n x +6 c d \,g^{3} x^{2}-2 c e \,f^{2} g n x +a f \,g^{2} n^{2}+5 a \,g^{3} n x -2 c d \,f^{2} g n +5 a f \,g^{2} n +6 a \,g^{3} x -6 c d \,f^{2} g +2 c e \,f^{3}+6 a f \,g^{2}\right ) \left (g x +f \right )^{n}}{\left (2+n \right ) \left (3+n \right ) \left (1+n \right ) g^{3}}\) \(223\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((g*x+f)^n*(c*e*x^2+2*c*d*x+a),x,method=_RETURNVERBOSE)

[Out]

(g*x+f)^(1+n)*(c*e*g^2*n^2*x^2+2*c*d*g^2*n^2*x+3*c*e*g^2*n*x^2+8*c*d*g^2*n*x-2*c*e*f*g*n*x+2*c*e*g^2*x^2+a*g^2
*n^2-2*c*d*f*g*n+6*c*d*g^2*x-2*c*e*f*g*x+5*a*g^2*n-6*c*d*f*g+2*c*e*f^2+6*a*g^2)/g^3/(n^3+6*n^2+11*n+6)

________________________________________________________________________________________

Maxima [A]
time = 0.31, size = 135, normalized size = 1.61 \begin {gather*} \frac {2 \, {\left (g^{2} {\left (n + 1\right )} x^{2} + f g n x - f^{2}\right )} {\left (g x + f\right )}^{n} c d}{{\left (n^{2} + 3 \, n + 2\right )} g^{2}} + \frac {{\left ({\left (n^{2} + 3 \, n + 2\right )} g^{3} x^{3} + {\left (n^{2} + n\right )} f g^{2} x^{2} - 2 \, f^{2} g n x + 2 \, f^{3}\right )} {\left (g x + f\right )}^{n} c e}{{\left (n^{3} + 6 \, n^{2} + 11 \, n + 6\right )} g^{3}} + \frac {{\left (g x + f\right )}^{n + 1} a}{g {\left (n + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)^n*(c*e*x^2+2*c*d*x+a),x, algorithm="maxima")

[Out]

2*(g^2*(n + 1)*x^2 + f*g*n*x - f^2)*(g*x + f)^n*c*d/((n^2 + 3*n + 2)*g^2) + ((n^2 + 3*n + 2)*g^3*x^3 + (n^2 +
n)*f*g^2*x^2 - 2*f^2*g*n*x + 2*f^3)*(g*x + f)^n*c*e/((n^3 + 6*n^2 + 11*n + 6)*g^3) + (g*x + f)^(n + 1)*a/(g*(n
 + 1))

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 224 vs. \(2 (90) = 180\).
time = 4.93, size = 224, normalized size = 2.67 \begin {gather*} \frac {{\left (a f g^{2} n^{2} - 6 \, c d f^{2} g + 6 \, a f g^{2} + 2 \, {\left (c d g^{3} n^{2} + 4 \, c d g^{3} n + 3 \, c d g^{3}\right )} x^{2} - {\left (2 \, c d f^{2} g - 5 \, a f g^{2}\right )} n + {\left (6 \, a g^{3} + {\left (2 \, c d f g^{2} + a g^{3}\right )} n^{2} + {\left (6 \, c d f g^{2} + 5 \, a g^{3}\right )} n\right )} x - {\left (2 \, c f^{2} g n x - 2 \, c f^{3} - {\left (c g^{3} n^{2} + 3 \, c g^{3} n + 2 \, c g^{3}\right )} x^{3} - {\left (c f g^{2} n^{2} + c f g^{2} n\right )} x^{2}\right )} e\right )} {\left (g x + f\right )}^{n}}{g^{3} n^{3} + 6 \, g^{3} n^{2} + 11 \, g^{3} n + 6 \, g^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)^n*(c*e*x^2+2*c*d*x+a),x, algorithm="fricas")

[Out]

(a*f*g^2*n^2 - 6*c*d*f^2*g + 6*a*f*g^2 + 2*(c*d*g^3*n^2 + 4*c*d*g^3*n + 3*c*d*g^3)*x^2 - (2*c*d*f^2*g - 5*a*f*
g^2)*n + (6*a*g^3 + (2*c*d*f*g^2 + a*g^3)*n^2 + (6*c*d*f*g^2 + 5*a*g^3)*n)*x - (2*c*f^2*g*n*x - 2*c*f^3 - (c*g
^3*n^2 + 3*c*g^3*n + 2*c*g^3)*x^3 - (c*f*g^2*n^2 + c*f*g^2*n)*x^2)*e)*(g*x + f)^n/(g^3*n^3 + 6*g^3*n^2 + 11*g^
3*n + 6*g^3)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 1489 vs. \(2 (75) = 150\).
time = 0.57, size = 1489, normalized size = 17.73 \begin {gather*} \begin {cases} f^{n} \left (a x + c d x^{2} + \frac {c e x^{3}}{3}\right ) & \text {for}\: g = 0 \\- \frac {a g^{2}}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} - \frac {2 c d f g}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} - \frac {4 c d g^{2} x}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} + \frac {2 c e f^{2} \log {\left (\frac {f}{g} + x \right )}}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} + \frac {3 c e f^{2}}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} + \frac {4 c e f g x \log {\left (\frac {f}{g} + x \right )}}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} + \frac {4 c e f g x}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} + \frac {2 c e g^{2} x^{2} \log {\left (\frac {f}{g} + x \right )}}{2 f^{2} g^{3} + 4 f g^{4} x + 2 g^{5} x^{2}} & \text {for}\: n = -3 \\- \frac {a g^{2}}{f g^{3} + g^{4} x} + \frac {2 c d f g \log {\left (\frac {f}{g} + x \right )}}{f g^{3} + g^{4} x} + \frac {2 c d f g}{f g^{3} + g^{4} x} + \frac {2 c d g^{2} x \log {\left (\frac {f}{g} + x \right )}}{f g^{3} + g^{4} x} - \frac {2 c e f^{2} \log {\left (\frac {f}{g} + x \right )}}{f g^{3} + g^{4} x} - \frac {2 c e f^{2}}{f g^{3} + g^{4} x} - \frac {2 c e f g x \log {\left (\frac {f}{g} + x \right )}}{f g^{3} + g^{4} x} + \frac {c e g^{2} x^{2}}{f g^{3} + g^{4} x} & \text {for}\: n = -2 \\\frac {a \log {\left (\frac {f}{g} + x \right )}}{g} - \frac {2 c d f \log {\left (\frac {f}{g} + x \right )}}{g^{2}} + \frac {2 c d x}{g} + \frac {c e f^{2} \log {\left (\frac {f}{g} + x \right )}}{g^{3}} - \frac {c e f x}{g^{2}} + \frac {c e x^{2}}{2 g} & \text {for}\: n = -1 \\\frac {a f g^{2} n^{2} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {5 a f g^{2} n \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {6 a f g^{2} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {a g^{3} n^{2} x \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {5 a g^{3} n x \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {6 a g^{3} x \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} - \frac {2 c d f^{2} g n \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} - \frac {6 c d f^{2} g \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {2 c d f g^{2} n^{2} x \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {6 c d f g^{2} n x \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {2 c d g^{3} n^{2} x^{2} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {8 c d g^{3} n x^{2} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {6 c d g^{3} x^{2} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {2 c e f^{3} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} - \frac {2 c e f^{2} g n x \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {c e f g^{2} n^{2} x^{2} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {c e f g^{2} n x^{2} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {c e g^{3} n^{2} x^{3} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {3 c e g^{3} n x^{3} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} + \frac {2 c e g^{3} x^{3} \left (f + g x\right )^{n}}{g^{3} n^{3} + 6 g^{3} n^{2} + 11 g^{3} n + 6 g^{3}} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)**n*(c*e*x**2+2*c*d*x+a),x)

[Out]

Piecewise((f**n*(a*x + c*d*x**2 + c*e*x**3/3), Eq(g, 0)), (-a*g**2/(2*f**2*g**3 + 4*f*g**4*x + 2*g**5*x**2) -
2*c*d*f*g/(2*f**2*g**3 + 4*f*g**4*x + 2*g**5*x**2) - 4*c*d*g**2*x/(2*f**2*g**3 + 4*f*g**4*x + 2*g**5*x**2) + 2
*c*e*f**2*log(f/g + x)/(2*f**2*g**3 + 4*f*g**4*x + 2*g**5*x**2) + 3*c*e*f**2/(2*f**2*g**3 + 4*f*g**4*x + 2*g**
5*x**2) + 4*c*e*f*g*x*log(f/g + x)/(2*f**2*g**3 + 4*f*g**4*x + 2*g**5*x**2) + 4*c*e*f*g*x/(2*f**2*g**3 + 4*f*g
**4*x + 2*g**5*x**2) + 2*c*e*g**2*x**2*log(f/g + x)/(2*f**2*g**3 + 4*f*g**4*x + 2*g**5*x**2), Eq(n, -3)), (-a*
g**2/(f*g**3 + g**4*x) + 2*c*d*f*g*log(f/g + x)/(f*g**3 + g**4*x) + 2*c*d*f*g/(f*g**3 + g**4*x) + 2*c*d*g**2*x
*log(f/g + x)/(f*g**3 + g**4*x) - 2*c*e*f**2*log(f/g + x)/(f*g**3 + g**4*x) - 2*c*e*f**2/(f*g**3 + g**4*x) - 2
*c*e*f*g*x*log(f/g + x)/(f*g**3 + g**4*x) + c*e*g**2*x**2/(f*g**3 + g**4*x), Eq(n, -2)), (a*log(f/g + x)/g - 2
*c*d*f*log(f/g + x)/g**2 + 2*c*d*x/g + c*e*f**2*log(f/g + x)/g**3 - c*e*f*x/g**2 + c*e*x**2/(2*g), Eq(n, -1)),
 (a*f*g**2*n**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 5*a*f*g**2*n*(f + g*x)**n/(g**3*
n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 6*a*f*g**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g*
*3) + a*g**3*n**2*x*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 5*a*g**3*n*x*(f + g*x)**n/(g
**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 6*a*g**3*x*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n +
6*g**3) - 2*c*d*f**2*g*n*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) - 6*c*d*f**2*g*(f + g*x)*
*n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 2*c*d*f*g**2*n**2*x*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2
+ 11*g**3*n + 6*g**3) + 6*c*d*f*g**2*n*x*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 2*c*d*g
**3*n**2*x**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 8*c*d*g**3*n*x**2*(f + g*x)**n/(g*
*3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 6*c*d*g**3*x**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*
n + 6*g**3) + 2*c*e*f**3*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) - 2*c*e*f**2*g*n*x*(f + g
*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + c*e*f*g**2*n**2*x**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*
n**2 + 11*g**3*n + 6*g**3) + c*e*f*g**2*n*x**2*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + c
*e*g**3*n**2*x**3*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 3*c*e*g**3*n*x**3*(f + g*x)**n
/(g**3*n**3 + 6*g**3*n**2 + 11*g**3*n + 6*g**3) + 2*c*e*g**3*x**3*(f + g*x)**n/(g**3*n**3 + 6*g**3*n**2 + 11*g
**3*n + 6*g**3), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 373 vs. \(2 (90) = 180\).
time = 3.81, size = 373, normalized size = 4.44 \begin {gather*} \frac {{\left (g x + f\right )}^{n} c g^{3} n^{2} x^{3} e + 2 \, {\left (g x + f\right )}^{n} c d g^{3} n^{2} x^{2} + {\left (g x + f\right )}^{n} c f g^{2} n^{2} x^{2} e + 3 \, {\left (g x + f\right )}^{n} c g^{3} n x^{3} e + 2 \, {\left (g x + f\right )}^{n} c d f g^{2} n^{2} x + 8 \, {\left (g x + f\right )}^{n} c d g^{3} n x^{2} + {\left (g x + f\right )}^{n} c f g^{2} n x^{2} e + 2 \, {\left (g x + f\right )}^{n} c g^{3} x^{3} e + 6 \, {\left (g x + f\right )}^{n} c d f g^{2} n x + {\left (g x + f\right )}^{n} a g^{3} n^{2} x + 6 \, {\left (g x + f\right )}^{n} c d g^{3} x^{2} - 2 \, {\left (g x + f\right )}^{n} c f^{2} g n x e - 2 \, {\left (g x + f\right )}^{n} c d f^{2} g n + {\left (g x + f\right )}^{n} a f g^{2} n^{2} + 5 \, {\left (g x + f\right )}^{n} a g^{3} n x - 6 \, {\left (g x + f\right )}^{n} c d f^{2} g + 5 \, {\left (g x + f\right )}^{n} a f g^{2} n + 6 \, {\left (g x + f\right )}^{n} a g^{3} x + 2 \, {\left (g x + f\right )}^{n} c f^{3} e + 6 \, {\left (g x + f\right )}^{n} a f g^{2}}{g^{3} n^{3} + 6 \, g^{3} n^{2} + 11 \, g^{3} n + 6 \, g^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)^n*(c*e*x^2+2*c*d*x+a),x, algorithm="giac")

[Out]

((g*x + f)^n*c*g^3*n^2*x^3*e + 2*(g*x + f)^n*c*d*g^3*n^2*x^2 + (g*x + f)^n*c*f*g^2*n^2*x^2*e + 3*(g*x + f)^n*c
*g^3*n*x^3*e + 2*(g*x + f)^n*c*d*f*g^2*n^2*x + 8*(g*x + f)^n*c*d*g^3*n*x^2 + (g*x + f)^n*c*f*g^2*n*x^2*e + 2*(
g*x + f)^n*c*g^3*x^3*e + 6*(g*x + f)^n*c*d*f*g^2*n*x + (g*x + f)^n*a*g^3*n^2*x + 6*(g*x + f)^n*c*d*g^3*x^2 - 2
*(g*x + f)^n*c*f^2*g*n*x*e - 2*(g*x + f)^n*c*d*f^2*g*n + (g*x + f)^n*a*f*g^2*n^2 + 5*(g*x + f)^n*a*g^3*n*x - 6
*(g*x + f)^n*c*d*f^2*g + 5*(g*x + f)^n*a*f*g^2*n + 6*(g*x + f)^n*a*g^3*x + 2*(g*x + f)^n*c*f^3*e + 6*(g*x + f)
^n*a*f*g^2)/(g^3*n^3 + 6*g^3*n^2 + 11*g^3*n + 6*g^3)

________________________________________________________________________________________

Mupad [B]
time = 3.07, size = 211, normalized size = 2.51 \begin {gather*} {\left (f+g\,x\right )}^n\,\left (\frac {f\,\left (2\,c\,e\,f^2-2\,c\,d\,f\,g\,n-6\,c\,d\,f\,g+a\,g^2\,n^2+5\,a\,g^2\,n+6\,a\,g^2\right )}{g^3\,\left (n^3+6\,n^2+11\,n+6\right )}+\frac {x\,\left (-2\,c\,e\,f^2\,g\,n+2\,c\,d\,f\,g^2\,n^2+6\,c\,d\,f\,g^2\,n+a\,g^3\,n^2+5\,a\,g^3\,n+6\,a\,g^3\right )}{g^3\,\left (n^3+6\,n^2+11\,n+6\right )}+\frac {c\,e\,x^3\,\left (n^2+3\,n+2\right )}{n^3+6\,n^2+11\,n+6}+\frac {c\,x^2\,\left (n+1\right )\,\left (6\,d\,g+2\,d\,g\,n+e\,f\,n\right )}{g\,\left (n^3+6\,n^2+11\,n+6\right )}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((f + g*x)^n*(a + 2*c*d*x + c*e*x^2),x)

[Out]

(f + g*x)^n*((f*(6*a*g^2 + a*g^2*n^2 + 2*c*e*f^2 + 5*a*g^2*n - 6*c*d*f*g - 2*c*d*f*g*n))/(g^3*(11*n + 6*n^2 +
n^3 + 6)) + (x*(6*a*g^3 + a*g^3*n^2 + 5*a*g^3*n + 2*c*d*f*g^2*n^2 + 6*c*d*f*g^2*n - 2*c*e*f^2*g*n))/(g^3*(11*n
 + 6*n^2 + n^3 + 6)) + (c*e*x^3*(3*n + n^2 + 2))/(11*n + 6*n^2 + n^3 + 6) + (c*x^2*(n + 1)*(6*d*g + 2*d*g*n +
e*f*n))/(g*(11*n + 6*n^2 + n^3 + 6)))

________________________________________________________________________________________